package main

import (
	"fmt"
	"time"
)

func test1() {
	go func() {

		defer func() {
			if err := recover(); err != nil {
				fmt.Println(err)
			}
		}()

	}()

	time.Sleep(2 * time.Second)
	panic("this is a pinic")

	for {
	}

}

func test2() {
	defer func() {
		if err := recover(); err != nil {
			fmt.Println(err)
		}
	}()
	time.Sleep(2 * time.Second)
	panic("this is a pinic")

}
func main() {
	//test1()
	test2()
}
